import axios from "../utils/axios"
export let getlist =()=>{
  return (dispatch)=>{

      axios.get("/api/list").then(res=>{
          if (res.data.code === 0) {
              window.location.href = "/login"
          } else {
            dispatch({
                type:"getlist",
                payload:res.data
            })
          }
         
      })
  }
}
export let searchfn = (data)=>{
    return {
        type:"searchfn",
        payload:data
    }
}
export let addFn = (data)=> {
    return {
        type:"addFn",
        payload:data
    }
}
export let delfn = (index)=>{
    return {
        type:'delfn',
        payload:index
    }
}
export let edifn = (item,index)=>{
    return {
        type:"edifn",
        payload:item,
        payload1:index
    }
}